<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

<script>
// 自定义对象
// 使用自定义的构造函数创建出来的实例对象

var obj1 = {name: '李四',sex: '女'};
var obj2 = new Object();
// obj1和obj2都是Object的实例对象

// 构造函数（类）
function Human(n,s){
    // this -> 创建出来的实例对象
    this.name = n;
    this.sex = s;
    this.say = function (){
        console.log( 'hello' );
    }
}
var zhangsan = new Human('张三','男');
console.log( zhangsan );// Human {name: '张三', sex: '男', say: ƒ}

function Cat(n,c){
    this.name = n;
    this.color = c;
}
var cat1 = new Cat('小黑','white');
console.log( cat1 );// Cat {name: '小黑', color: 'white'}

// obj1 obj2 zhangsan cat1 从数据类型来看，都是object类型
// 从对象分类来看 obj1和obj2是同一个类型Object  zhangsan是Human  cat1是Cat

</script>
</body>
</html>